import request from '@/utils/request'

export function getRoleList(params) {
  return request({
    url: '/sys/role',
    params: params
  })
}

export function getCompanyInfo(companyId) {
  return request({
    url: `/company/${companyId}`
  })
}

// 删除公司角色的接口
export function deleteRoleById(id) {
  return request({
    url: `/sys/role/${id}`,
    method: 'delete'
  })
}

export function updateRole(data) {
  return request({
    url: `/sys/role/${data.id}`,
    data: data,
    method: 'put'
  })
}

export function getRoleDetail(id) {
  return request({
    url: `/sys/role/${id}`
  })
}

export function addRole(data) {
  return request({
    url: '/sys/role',
    data: data,
    method: 'post'
  })
}

// 给角色分配权限
export function assignPerm(data) {
  return request({
    url: '/sys/role/assignPrem',
    method: 'put',
    data
  })
}
